const _import = require('@/router/_import')
import Main from '@/views/Main';

// 不作为Main组件的子页面展示的页面单独写，如下
export const loginRouter = {
    path: '/login',
    name: 'login',
    component: _import('login')
};


// 作为Main组件的子页面展示但是不在左侧菜单显示的路由写在otherRouter里
export const otherRouter = [{
        path: '/',
        name: 'otherRouter',
        redirect: '/home',
        component: Main,
        children: [
            { path: 'home', title: {i18n: 'home'}, name: 'home_index', component: _import('home/index') },
        ]
    },
    {
        path: '/locking',
        name: 'locking',
        component:  _import('locking') 
    }
];

// 作为Main组件的子页面展示并且在左侧菜单显示的路由写在appRouter里
export const appRouter = [
    {
        path: '/system',
        icon: 'wrench',
        name: 'system',
        title: '系统配置',
        access:'system',
        component: Main,
        children: [
            {
                path: 'menu',
                icon: 'navicon-round',
                name: 'menu',
                access: 'system:menu',
                title: '菜单维护',
                component: _import('system/menu/index')

            },
            {
                path: 'user',
                icon: 'ios-people',
                name: 'user',
                access: 'system:user',
                title: '用户管理',
                component: _import('system/user/index')
            },
            {
                path: 'auth',
                icon: 'locked',
                name: 'auth',
                access: 'system:auth',
                title: '权限管理',
                component: _import('system/auth/index')
            },
            {
                path: 'role',
                icon: 'locked',
                name: 'role',
                access: 'system:role',
                title: '角色管理',
                component: _import('system/role/index')
            },
            {
                path: 'log',
                icon: 'clipboard',
                name: 'log',
                access: 'system.log',
                title: '操作日志',
                component: _import('system/log/index')
            }
        ]
    },
    {
        path: '/news',
        icon: 'wrench',
        name: 'news',
        title: '新闻中心',
        access:'rule.news',
        component: Main,
        children: [
            {
                path: 'news-list',
                icon: 'navicon-round',
                name: 'news-list',
                access: 'rule.news.list',
                title: '新闻列表',
                component: _import('news/news-list')

            }
        ]
    }
];

// 所有上面定义的路由都要写在下面的routers里
export const routers = [
    loginRouter,
    ...otherRouter,
    ...appRouter
];